1 00:00:00,000 --> 00:00:14,440 This is Hacker Public Radio episode 3,848 for Wednesday the 3rd of May 2023. 2 00:00:14,440 --> 00:00:20,560 Today's show is entitled, Editing Thunderbird email filters using them. 3 00:00:20,560 --> 00:00:26,760 It is the 30th show some guy on the internet and is about 31 minutes long. 4 00:00:26,760 --> 00:00:29,400 It carries a clean flag. 5 00:00:29,400 --> 00:00:41,080 The summary is, Scoti uses them sessions to quickly edit his email filters. 6 00:00:41,080 --> 00:00:45,720 Hello and welcome to another episode of Hacker Public Radio, I'm your host, some guy 7 00:00:45,720 --> 00:00:47,080 on the internet. 8 00:00:47,080 --> 00:00:49,360 Today we're discussing Thunderbird filters. 9 00:00:49,360 --> 00:00:53,400 I'm going to be typing while discussing this episode so if you're here to clicking 10 00:00:53,400 --> 00:00:55,600 in the background, it can't be avoided. 11 00:00:56,000 --> 00:00:59,280 I'm going to go over a couple of prerequisites with you. 12 00:00:59,280 --> 00:01:03,320 They are five in total but I'm only going to discuss the first two really quickly. 13 00:01:03,320 --> 00:01:09,120 First one, backup all of your data, especially your Thunderbird directory. 14 00:01:09,120 --> 00:01:12,440 Again, all of your data needs to be backed up. 15 00:01:12,440 --> 00:01:15,760 Step two, confirm your backups. 16 00:01:15,760 --> 00:01:19,640 Make sure that they're working trial restoring one of your backups before proceeding. 17 00:01:19,640 --> 00:01:23,640 All right, you can read through the rest in the show notes of the other prerequisites. 18 00:01:23,640 --> 00:01:24,640 Let's begin. 19 00:01:24,680 --> 00:01:29,280 All right, I'm going to be doing this from a good new Linux distribution. 20 00:01:29,280 --> 00:01:34,480 Pop-O-S is the distribution that I'm using so I have the app package manager. 21 00:01:34,480 --> 00:01:39,000 My Thunderbird install is through the package manager so it's the dot-depth file. 22 00:01:39,000 --> 00:01:43,920 The install is in the home slash dot Thunderbird sub directory. 23 00:01:43,920 --> 00:01:48,240 I have some information for those of you on other distributions or if you're using 24 00:01:48,240 --> 00:01:52,400 different package managers, there's some information down the show notes. 25 00:01:52,400 --> 00:01:56,640 All right, we're going to be using them to manipulate the filters because the filters 26 00:01:56,640 --> 00:02:02,080 are located within the dot Thunderbird directory, but it's going to have like a African 27 00:02:02,080 --> 00:02:07,080 Merit string followed by dot default release. 28 00:02:07,080 --> 00:02:10,240 That's if you have a single instance of Thunderbird. 29 00:02:10,240 --> 00:02:16,720 If you have multiple instances, it will be the African Merit string dot default release 30 00:02:16,800 --> 00:02:22,800 followed by a hyphen once or a hyphen to that kind of nomenclature. 31 00:02:22,800 --> 00:02:28,720 Then further down into the sub directories, you'll have your iMap mail followed by the account 32 00:02:28,720 --> 00:02:30,720 itself surface at Google. 33 00:02:30,720 --> 00:02:37,440 It'll say dot iMap dot Google or yeah, whoever you got within that sub directory, there 34 00:02:37,440 --> 00:02:42,120 will be the message filter rules dot dot file. 35 00:02:42,200 --> 00:02:46,520 The message filter rules dot that file is your filters. 36 00:02:46,520 --> 00:02:51,320 We're going to use them to navigate to that file, open it up and then I'm also going to use 37 00:02:51,320 --> 00:02:55,240 them to open up the VIM session that I'm using. 38 00:02:55,240 --> 00:02:57,480 But first let's talk about the VIM session. 39 00:02:57,480 --> 00:03:03,480 The VIM sessions, it just files that store information about your working session. 40 00:03:03,480 --> 00:03:08,280 The one that I crafted for Thunderbird is a custom one that just created an empty file, 41 00:03:08,360 --> 00:03:16,120 found named dot VIM, and then I imported or created the rules that I wanted for that session 42 00:03:16,120 --> 00:03:17,640 inside of that file. 43 00:03:17,640 --> 00:03:22,440 So if you're familiar with VIM mappings, I mapped out a bunch of things that I want to do 44 00:03:22,440 --> 00:03:23,800 within that file. 45 00:03:23,800 --> 00:03:26,120 So now I can source that file. 46 00:03:26,120 --> 00:03:31,240 When you source a VIM session, it's basically extending VIM. 47 00:03:31,240 --> 00:03:35,560 So you don't have to carry all of those different functions that you've created 48 00:03:35,560 --> 00:03:39,800 into every single project, you can have a custom set per project. 49 00:03:39,800 --> 00:03:44,360 Example, when I'm doing the old known news, I don't want those functions present. 50 00:03:44,360 --> 00:03:48,600 When I'm editing a Thunderbird filter, because that's a lot of markdown. 51 00:03:48,600 --> 00:03:51,880 And the Thunderbird filter has no markdown in. 52 00:03:51,880 --> 00:03:53,000 So let's begin. 53 00:03:53,000 --> 00:03:57,720 Now first set up the work environment by opening up the message filter that I'm going to be using. 54 00:03:57,720 --> 00:04:02,360 So you can navigate in your system, find your email account that you'd want to edit the 55 00:04:02,440 --> 00:04:07,400 filters for, and while I'm on that topic, you're going to want to first create filters. 56 00:04:07,400 --> 00:04:11,320 Because obviously if you don't have any, then you can edit them. 57 00:04:11,320 --> 00:04:16,760 So I'm going to use VIM, navigate to the correct account, grab that filter file and open it up. 58 00:04:16,760 --> 00:04:22,600 I'm going to be making it as directly within the filter file, but to complex work itself, 59 00:04:22,600 --> 00:04:28,120 that happens to the section of the filter, will happen in another file that I call CB. 60 00:04:28,120 --> 00:04:32,680 In my home directory, I have a file called CB, CB is short for clipboard. 61 00:04:32,680 --> 00:04:37,880 It's just a basic text file, no extension or anything like that, because Linux does not require 62 00:04:37,880 --> 00:04:41,960 you to have extensions for it to recognize the use of the file. 63 00:04:41,960 --> 00:04:45,640 And I created it using Touch, but I'm going to open up CB as well. 64 00:04:45,640 --> 00:04:50,520 So that way, I can copy the filter from the filter file. 65 00:04:50,520 --> 00:04:56,440 You know, the important part that I'm going to edit, copy that over to CB, and then begin the 66 00:04:56,520 --> 00:04:58,920 complex work within CB. 67 00:04:58,920 --> 00:05:05,480 So CB is going to actually have the source of the VIM session where all the complex work will 68 00:05:05,480 --> 00:05:11,640 happen. Let's begin. If you're new to Thunderbird in the audience, and you want to hear more about 69 00:05:11,640 --> 00:05:16,280 creating the filters themselves, just let me know, leave a comment down below, and I'll do a 70 00:05:16,280 --> 00:05:23,000 show on creating filters. I also wanted to update Thunderbird's documentation on this object. 71 00:05:23,080 --> 00:05:28,040 However, it was this long sort of loop around of, you have the user Mazula account, 72 00:05:28,040 --> 00:05:32,040 not the Thunderbird account, which I thought Thunderbird had broken away from Mazula when it 73 00:05:32,040 --> 00:05:37,400 created their own website. So you use your Mazula account. Then you have to, uh, 74 00:05:37,400 --> 00:05:41,480 I believe they require you to use Sumo or something like that. It's some sort of 75 00:05:41,480 --> 00:05:46,280 markup language that they use, which was kind of weird, and I just wanted to use, you know, 76 00:05:46,280 --> 00:05:51,880 other texts or, you know, paned out flavored markdown. I'll eventually get around to figure 77 00:05:51,960 --> 00:05:58,280 in out more about their submission requirements for updating documentation, and then I'll try to update 78 00:05:58,280 --> 00:06:03,720 their documentation. But until then, I'll probably just create my own because it'll be faster. 79 00:06:03,720 --> 00:06:08,840 I can just use the technology that I already have at hand, which is marked down, and it's great. 80 00:06:08,840 --> 00:06:12,840 I'll probably have to include some pictures, some things that I nature as well, and I plan on 81 00:06:12,840 --> 00:06:21,400 doing a video on it in the future. So we have VIM open with two buffers that is our filter in one buffer 82 00:06:21,480 --> 00:06:27,960 that we're going to be grabbing the actual filtering properties from, and we have CB, 83 00:06:27,960 --> 00:06:36,360 which is my clipboard text file in the second buffer. I have CB sourced to the VIM session that I want 84 00:06:36,360 --> 00:06:42,040 to use, and later on we'll go into detail about the VIM session. All right, right now I'm going to open 85 00:06:42,040 --> 00:06:48,360 Thunderbird and I'll just give you a brief on how my filters are set up just a quick little brief 86 00:06:49,240 --> 00:06:55,000 there. So if you open up Thunderbird, press Alt and bring your menu bar down, they can use T to go to 87 00:06:55,000 --> 00:07:01,640 tools and F to go to message filters. Inside of my filters for the account that I'm about to be editing, 88 00:07:01,640 --> 00:07:08,360 I have my junk filters at the very top. You know, there's this spam assassin. I turned that 89 00:07:08,360 --> 00:07:14,520 on and off, depending on how I feel, followed by one that I call deleted, that just holds domains 90 00:07:14,520 --> 00:07:21,640 in it that I want to delete all messages from, and I have two more after that called junk filters. 91 00:07:21,640 --> 00:07:29,640 Now the reason I have separated deleted from junk, the deleted filter will take away mail that I 92 00:07:29,640 --> 00:07:36,440 intentionally subscribe to, but no longer wish to receive mail from. I do not want to classify 93 00:07:36,440 --> 00:07:44,040 those innocent newsletters and other projects as junk. I just no longer wish to receive 94 00:07:44,040 --> 00:07:50,680 messages from them, and I'm not about to go through the whole unsubscribe, who I do you want to unsubscribe 95 00:07:51,560 --> 00:07:56,200 where we not helpful blah blah blah. And who knows in the future, I may want to receive information 96 00:07:56,200 --> 00:08:02,440 from them again, but I'd have to sign up for it again. So with this method, I just throw them in the 97 00:08:02,440 --> 00:08:08,680 delete filter, which will automatically delete all things from them. And what I do inside of that filter, 98 00:08:08,760 --> 00:08:17,160 I specify the domain, so you'll have newsletter at newsgroup.com. I'll remove the portion that says 99 00:08:17,160 --> 00:08:25,640 newsletter and only keep the at newsgroup.com. In that way, anything from at newsgroup.com, 100 00:08:25,640 --> 00:08:32,280 that enters my inbox will be filtered out. It'll just be deleted. Now the junk filters that I have, 101 00:08:32,280 --> 00:08:37,960 those are just things I don't know how I got on their mail list, but I no longer want to receive it, 102 00:08:37,960 --> 00:08:44,120 and I want it marked as junk. So that's why I have the separate deleted filters. The junk 103 00:08:44,120 --> 00:08:51,400 will also delete, but it marks them as junk first. From there, I have a few tag filters. For any 104 00:08:51,400 --> 00:08:58,280 bills or obligations that I may have, when that information comes in, it will be tagged as a bill. 105 00:08:58,280 --> 00:09:03,080 So there's a few strings that I look for in the message, because normally whenever it's a bill, 106 00:09:03,400 --> 00:09:09,240 it's the same string over and over. And when I'm using a string style messaging filter, meaning 107 00:09:09,240 --> 00:09:16,520 I'll filter from this subject of the message rather than using the address the message gene from 108 00:09:16,520 --> 00:09:22,760 for these tags. I'll pull the string and I usually pick three to four words, three to four words 109 00:09:22,760 --> 00:09:27,800 that appear consecutively. So they can't just be like the first word, the middle word, and the 110 00:09:27,800 --> 00:09:32,840 last word. And as we three to four words consecutively, I picked those three to four words that 111 00:09:32,840 --> 00:09:38,760 best sum up with the email is about, put that in the filter, and that way every time that message 112 00:09:38,760 --> 00:09:45,240 appears in my inbox, it will automatically be tagged. The tag just applies a color over it. So 113 00:09:45,240 --> 00:09:50,920 for a bill, it'll let's just say go on or into it'll pop up as orange. Now I also have other filters 114 00:09:50,920 --> 00:09:57,400 behind that that will then take those messages and move them to a directory where they can be 115 00:09:57,400 --> 00:10:04,040 filtered out of the inbox. I just wanted them tagged first so that way I can identify the bills 116 00:10:04,440 --> 00:10:12,840 from any other say news letters that those organizations may also send out. Now at the bottom of my 117 00:10:12,840 --> 00:10:21,240 filters I have other subject base filters and these are manual ones and basically like, like, 118 00:10:21,240 --> 00:10:26,360 for instance, my bank directory. I want to keep the important stuff from the bank, but all the 119 00:10:26,360 --> 00:10:31,240 other promotional garries that they send. I don't want to keep all of that, but my main bank 120 00:10:31,240 --> 00:10:37,640 filter pulls from the domain. So anything from that domain that I have verified will be placed 121 00:10:37,640 --> 00:10:42,920 in the bank folder including all of the promotional garbage that I don't want to see. The important 122 00:10:42,920 --> 00:10:49,080 stuff will be tagged so that I can easily identify visually and other stuff that I don't want. 123 00:10:49,720 --> 00:10:56,280 I throw those into a separate manual filter so that it does not automatically run that's important. 124 00:10:56,280 --> 00:11:02,760 And when I'm ready to do an archive on my bank folder, I run the manual filter on it first 125 00:11:02,760 --> 00:11:07,640 to filter out all the promotional garbage which I have, you know, I continuously add to it because 126 00:11:07,640 --> 00:11:14,840 as they come out with new promotional garbage, again select three to four words from the promotional 127 00:11:14,840 --> 00:11:21,160 subject of the email add that to the filter that I'm going to use to manually remove everything. 128 00:11:21,240 --> 00:11:27,080 And I run that filter against the bank directory to remove the garbage so that I can then 129 00:11:27,080 --> 00:11:31,320 archive the important stuff. All right, now that we went through all that, 130 00:11:31,320 --> 00:11:36,440 let's go ahead and switch over to VAM and it will begin editing. All right here in VAM 131 00:11:36,440 --> 00:11:42,520 within our filter file, one thing you'll notice is all the filters are in this single file 132 00:11:42,520 --> 00:11:48,440 for the email account that we have selected. When you're using Thunderbird to create filters, 133 00:11:48,520 --> 00:11:55,400 it appears as though there's a separate file being created per filter. That's what the UI sort of 134 00:11:55,400 --> 00:12:03,800 visually implies. However on the back end, the config or the file itself is just one file where 135 00:12:03,800 --> 00:12:11,800 each figure excuse me each filter is spelled out in between two two properties. The first is the name 136 00:12:11,800 --> 00:12:17,480 where the filter begins is called name and the last will be condition. So everything in between 137 00:12:17,560 --> 00:12:23,320 those two properties are part of the filter. And you'll see the words so if you search name 138 00:12:23,320 --> 00:12:29,000 inside of that file, you'll see it appears numerous times based on how many filters you have. 139 00:12:29,000 --> 00:12:33,320 Same thing with condition. I do want to point out you want to close your Thunderbird. You do 140 00:12:33,320 --> 00:12:39,160 not want your Thunderbird running while you're editing the filter. So if you have it open, 141 00:12:39,160 --> 00:12:43,480 now it's time to go ahead and close it before you start manipulating anything. Now what we're 142 00:12:43,480 --> 00:12:50,280 going to look for is the condition. Those are the actual things that you have said I want this 143 00:12:50,280 --> 00:12:56,680 stuff filtered out. So the domains or if it's a specific email address or a subject, whatever, 144 00:12:56,680 --> 00:13:01,160 it's going to be located inside the section and say it's condition. I'm going to go ahead and select 145 00:13:01,160 --> 00:13:08,040 my very first filter, which is the deleted filter. And I see the conditions for here online seven. 146 00:13:08,040 --> 00:13:13,880 So I'm going to go ahead and use let me go and get them down there. I'm going to double why on that 147 00:13:13,880 --> 00:13:22,760 to yank that line. Now let's open up VIM's command using the colon to be in. So that's our Bravo 148 00:13:22,760 --> 00:13:28,760 Nano or whatever the other thing is to us which to the next buffer, where CB will be waiting with 149 00:13:28,760 --> 00:13:36,120 a blank canvas for me. And then I press P to paste that condition into CB. And let me go ahead and 150 00:13:36,200 --> 00:13:45,000 source going to command mode and VIM under the CB file do SO and then we'll begin to select our 151 00:13:45,720 --> 00:13:52,040 session that we want to use here, which is the Thunderbird filter VIM session that I have created. 152 00:13:52,040 --> 00:13:59,480 So now that I have sourced that within CB, I now have access to those custom things that I've created 153 00:13:59,480 --> 00:14:04,520 to run on this file. All right. So one of the things you're going to notice when you put that filter 154 00:14:04,520 --> 00:14:10,280 in there, it's going to depending on how many things you have in it minus quite long. It's been added 155 00:14:10,280 --> 00:14:17,080 to over the years. So it's going to go out quite far. It's going to start with condition having 156 00:14:17,080 --> 00:14:24,360 equal sign followed by the double quotes. And now if I do the dollar sign, which takes me all 157 00:14:24,360 --> 00:14:29,800 away to the end of the string, you'll see it'll have all the properties within it separated by 158 00:14:29,800 --> 00:14:37,000 the word OR. There's a capital OR Oscar Rohel and then the very end of the string there'll be another 159 00:14:37,000 --> 00:14:43,160 set of double quotes. On that set, but it'll it'll be the completion of this set double quote. 160 00:14:43,160 --> 00:14:48,040 This is all to get back to the beginning. Now what I'm going to do to start my filter here 161 00:14:48,040 --> 00:14:53,320 or to break down this filter, I should say, I'm going to use the leader key, which is the back 162 00:14:53,400 --> 00:15:00,600 slash leader key one there. And now my filter is completely broken down and separated and so that 163 00:15:00,600 --> 00:15:07,160 way I can see every single element of that filter on its own line. Let's talk about what that 164 00:15:07,880 --> 00:15:14,920 function for or mapping. Yeah, it's a map. Let's talk about what that map does. I'll have the maps 165 00:15:14,920 --> 00:15:22,120 for this VM session inside of the show notes so you can see what it's doing. Let's talk about it real quick. 166 00:15:22,120 --> 00:15:28,360 So you'll see the very first one is a normal mode that's what the first end is for. And then it's 167 00:15:28,360 --> 00:15:36,760 NORE that's from no recursive map, normal mode, no recursive map. Then you'll see the leader, 168 00:15:36,760 --> 00:15:43,960 which is the leader key. I think the default is back slash one the number one. So every time I've had 169 00:15:43,960 --> 00:15:50,680 press back slash one, it's going to perform the function to see that follow the commands that follow 170 00:15:50,760 --> 00:15:56,360 the text there. So let's talk about what that's doing. It's going to delete two words. The two 171 00:15:56,360 --> 00:16:00,760 words that we're looking at. Well, one of them's not technically word, but for them sake, 172 00:16:00,760 --> 00:16:07,000 we're going to call it a word. It is the word condition at the beginning of the filter, 173 00:16:07,000 --> 00:16:14,200 followed by that equal sign and the first of the double quotes. Then it's going to run 174 00:16:14,280 --> 00:16:21,160 VM's redjacks. It's like said, but you know, it's basically said, let's take closest 175 00:16:21,160 --> 00:16:25,560 thing I can think of. It's going to run this redjacks, which will look for each of those 176 00:16:25,560 --> 00:16:31,000 ors, which is the separation in between the properties that you want to filter out and space 177 00:16:31,000 --> 00:16:37,160 them onto their own lines. Then one thing I want to point out is taking the space at the beginning 178 00:16:37,160 --> 00:16:45,960 of or and replacing it with a new line in VM, the new line is not back slash in when you're doing 179 00:16:45,960 --> 00:16:54,040 redjacks is back slash r. So if you, you're going to see r forward slash back slash r. So we're 180 00:16:54,040 --> 00:16:58,840 replacing the space with the new line with that. And we're going to follow it up with a character 181 00:16:58,840 --> 00:17:05,000 return. Also, I used global on that because otherwise it would just stop at the first or. So you 182 00:17:05,000 --> 00:17:10,840 use global to carry that through the entire string because it's a very long string. So that's our 183 00:17:10,840 --> 00:17:17,640 first leader thing that we're doing there. Now that we have it broken down onto their own lines, 184 00:17:17,640 --> 00:17:24,040 let me use a GG to go to the top. Now I want to make sure that everything is lower case 185 00:17:24,680 --> 00:17:31,720 because if you have capital case letters and lower case letters, it'll mess up with the sort 186 00:17:31,880 --> 00:17:38,840 function that we're going to use next and we don't want that. So we build into this next mapping 187 00:17:38,840 --> 00:17:45,720 the ability to sort everything and make sure that slower case before the sort happens. So that 188 00:17:45,720 --> 00:17:54,600 everything gets alphabetized correctly. Otherwise you have something like a capital D placed in front 189 00:17:54,600 --> 00:18:00,280 of a lower case A. Now this part is not necessary. It's just something I like to do. 190 00:18:01,800 --> 00:18:07,880 Also removing the duplicates. That's also another feature that I have built into this sort. 191 00:18:07,880 --> 00:18:15,800 So if you look down into the show notes, you'll see the next normal no recursive map set to 192 00:18:15,800 --> 00:18:22,840 leader S1. That's my sort function. You'll see that it goes to the top of the map using GG. 193 00:18:22,840 --> 00:18:28,120 I mean, not map the top of the buffer the file. It uses the old to make sure it's in a very top 194 00:18:29,080 --> 00:18:36,920 left. Then it uses two F so that it can find the second comma located within the filter. 195 00:18:36,920 --> 00:18:43,320 So if we switch over real quick. So once I have the lines broken down, it also onto there. Once I have 196 00:18:43,320 --> 00:18:51,160 the filter broken down where each element is on their own line, it should say OR, the capital OR. 197 00:18:51,160 --> 00:18:59,560 You have a set of parentheses with the word from comma contains comma. Then the thing that you 198 00:18:59,560 --> 00:19:04,520 want to filter out. All right. I'm taking a short break. My air conditioning just came on. I just 199 00:19:04,520 --> 00:19:09,400 wanted you to see what it sounds like with air conditioning on. But I'm going to stop now and come 200 00:19:09,400 --> 00:19:15,720 back when air conditioning goes off. All right. Where are we? All right. So in that leader S2 201 00:19:16,680 --> 00:19:22,760 Excuse me. In the leader S1, we get our GG top of the file. Zero. Make sure that we're on the 202 00:19:22,760 --> 00:19:30,360 very first character. F2, taking us to the second comma followed by CV, which is control V. That's 203 00:19:30,360 --> 00:19:36,120 how you spell it in your when you're doing to them. Mapping's inside your session file. We got 204 00:19:36,120 --> 00:19:43,560 a control V, which gives us a visual blocking. So in your visual module, you can do visual sections 205 00:19:43,640 --> 00:19:49,080 by using the lowercase V and then selecting the text. Then you get your visual line, which will 206 00:19:49,080 --> 00:19:56,360 cover the entire line using capital V. Right now we're using control V. So we can select a specific 207 00:19:56,360 --> 00:20:03,800 block of text. After control V, you see we go to the very bottom of the file using capital G, 208 00:20:03,800 --> 00:20:11,000 followed by the dollar sign, which then takes that block toward the end of the strings. Then we have 209 00:20:11,800 --> 00:20:17,640 you, which takes everything that's selected by that visual block, it makes it lowercase. Now the 210 00:20:17,640 --> 00:20:23,640 function, I mean now the process starts over again, going to the top of the file using GG and zero. 211 00:20:23,640 --> 00:20:32,280 The two F, again taking us to the second comma with the control V, visual blocking, or selecting 212 00:20:32,280 --> 00:20:38,360 a visual block. G, bottom of the file, dollar sign, end of the block. And now we run this sort 213 00:20:38,360 --> 00:20:43,240 function. So you can see we're going to command mode using the cobbling, followed by a sword, 214 00:20:43,240 --> 00:20:49,880 and we sort using the U flag. Now this is VIM's sort, not the command sort that you've normally 215 00:20:49,880 --> 00:20:57,080 doing the terminal. So you don't need the sort, space, hyphen, U. When you're doing it in VIM, 216 00:20:57,080 --> 00:21:04,440 you just use source. I mean, sort, space, U. We followed that up with a character return, 217 00:21:04,600 --> 00:21:10,360 which is the greater than less than surrounding capital CR. That's how you do a character 218 00:21:10,360 --> 00:21:17,720 turn in a VIM mapping. And then we move back to the top of the file using GG, zero. So that's 219 00:21:17,720 --> 00:21:25,720 going to go ahead and take all of those different email addresses, or if it's a string-based filter, 220 00:21:25,720 --> 00:21:31,320 where I'm filtering from the subject, make it all lowercase, then sort it alphabetically. 221 00:21:31,320 --> 00:21:35,640 I don't know if I said this already or because I had to keep coming back and forth 222 00:21:35,640 --> 00:21:42,040 whenever the air condition comes on. But if you have a capital letter in there, in your filters, 223 00:21:42,040 --> 00:21:48,200 it'll upset the alphabetical order that sort will use. So a capital D could be placed in front 224 00:21:48,200 --> 00:21:53,720 of a lowercase A just because it was capitalized. We want to avoid that so we make everything, 225 00:21:53,720 --> 00:22:00,120 you know, lowercase first. Now once we're done, and everything's already filtered up and 226 00:22:00,120 --> 00:22:07,000 alphabetized, we should be at the top of our file. That's why I have the GG zero at the end of that 227 00:22:07,000 --> 00:22:13,480 mapping. And all we have to do is, like, say for instance, if we have 50 lines of filters that have 228 00:22:13,480 --> 00:22:21,320 been broken down onto their own individual line, I'll just type in 51 and do a capital J. In VIM, 229 00:22:21,320 --> 00:22:28,280 the capital J will take the line beneath the line that you're on and bring it up to the line 230 00:22:28,280 --> 00:22:34,600 that you're on and separate it with the space. So you're restructuring the filter by doing 231 00:22:34,600 --> 00:22:39,320 the capital J. And I don't need an actual mapping for that. I mean, it's just, you know, 232 00:22:39,320 --> 00:22:44,680 type in. Type in the number of times you wanted to happen, plus the capital J boom, it's done. 233 00:22:44,680 --> 00:22:50,040 So now that's going to restructure the filter. And then we have the last 234 00:22:50,040 --> 00:22:56,280 letter, which is the letter 2. You should see all of that in the show notes. The letter 2, 235 00:22:56,360 --> 00:23:02,440 which goes to the beginning of the string, once it's been restructured, using the capital I, 236 00:23:02,440 --> 00:23:10,840 inserts the word condition equal sign double quote. And, you know, rebuilds the, uh, 237 00:23:10,840 --> 00:23:17,800 rebuild the filter the way it was. And it should give an error when it runs because that last 238 00:23:17,800 --> 00:23:24,360 little bit of red jacks on the end is just to make sure that there was no, uh, space before the last 239 00:23:24,440 --> 00:23:30,600 quotation. I have had that at times where there was like a space at the end of it. Sometimes it happens. 240 00:23:30,600 --> 00:23:35,640 There's another thing that happens as well when you're structuring your, when you're breaking 241 00:23:35,640 --> 00:23:41,880 down your filter, the very last item that gets broken down does not have a space after it. 242 00:23:41,880 --> 00:23:48,520 And you want to make sure that there's a space after it. So I have another, uh, another thing I need to add 243 00:23:48,520 --> 00:23:53,400 in here. I think I forgot to add it. Let me go ahead and add that real quick. Okay. I just added it. 244 00:23:53,480 --> 00:23:59,160 I forgot to put it in when it was, uh, constructing a show notes. But um, that item that is normally 245 00:23:59,160 --> 00:24:05,480 at the end of the filter will not have a space after it. So when it gets filtered, when it gets, uh, 246 00:24:05,480 --> 00:24:12,520 sorted alphabetically, it will break their filter if you don't have a space after it during reconstruction 247 00:24:12,520 --> 00:24:17,640 in the section where I mentioned I used the capital J to reconstruct the filter. So that's why we 248 00:24:17,720 --> 00:24:26,360 have the leader in one. So before we do the capital J to reconstruct the filter onto one line again, 249 00:24:26,760 --> 00:24:35,160 we run leader in one. It's going to perform the same type of red jacks that was done in leader S1 250 00:24:35,160 --> 00:24:40,200 where it goes to the top of the file. It's going to select everything using capital V, then in 251 00:24:40,200 --> 00:24:47,400 capital G, going to command mode and then use the set style red jacks to ensure that there is a 252 00:24:48,280 --> 00:24:54,520 there's a space at the end of the line. So if there's, if there's not a space there, it will add one. 253 00:24:54,520 --> 00:25:01,080 And if there's more than one space at the end of the line, it'll reduce it to a single space. 254 00:25:01,080 --> 00:25:05,400 And it's going to follow that up with the character turn and take you back to the top of the file. 255 00:25:05,400 --> 00:25:09,640 So that each of the individual elements when it separated onto their own line, 256 00:25:09,640 --> 00:25:15,640 you can ensure that every single one of them have a space at the end of the element so that when you 257 00:25:15,720 --> 00:25:21,320 do the reconstruction using capital J, it all fits together properly. Otherwise, 258 00:25:21,320 --> 00:25:27,960 one of those sections that is separated by the capital all or, you know what? I'm just going to 259 00:25:27,960 --> 00:25:32,120 finish recording through it because the air condition keeps coming on and off. I'm sorry, 260 00:25:32,120 --> 00:25:37,240 if it bothers you with the home of the air condition, that trauma best added it down. So that 261 00:25:37,240 --> 00:25:43,720 that's normally where your filter is going to break. One of those ors will not have a space 262 00:25:43,800 --> 00:25:49,880 either before or after. So I like to take care of that ahead of time. Now at the very end of your 263 00:25:49,880 --> 00:25:57,880 filter as well, before the the last quotation marks once you've used capital J to reconstruct it. 264 00:25:57,880 --> 00:26:06,280 And then you run the leader too, which reinserts the word condition equals quotation. And then it 265 00:26:06,280 --> 00:26:12,920 replaces the other quotation at the end of the filter. Sometimes they'll be a space before that 266 00:26:13,000 --> 00:26:19,160 last quotation. And that's why you see that red jacks in there removes that space before the last 267 00:26:19,160 --> 00:26:25,880 quotation at the end of the string. So if you get an error, that's because there was no space before 268 00:26:25,880 --> 00:26:31,080 the last quotation, which in that case is fine. Nothing to complain about. You get an error, 269 00:26:31,080 --> 00:26:37,320 because there was no space there. If you don't get there, that means there was a space there 270 00:26:37,320 --> 00:26:43,000 and a red jacks work. It took it away. Now always double check. I just do a $1 sign to bounce 271 00:26:43,000 --> 00:26:47,880 to the end of your string. Take a quick peek. Okay, no space. It's got the double quilt there. 272 00:26:48,440 --> 00:26:54,360 Zero to take me back to the base there. I save it into the clipboard. You know, command 273 00:26:54,360 --> 00:27:01,000 mode W. Double Y to yank that. Then I use the buffer one. You know, go back in a command mode. 274 00:27:01,000 --> 00:27:06,920 V1 to take me back to the first buffer, which is my message, which is the filter. I use 275 00:27:06,920 --> 00:27:15,560 P to insert the now reconstructed filter into the file and I delete the old one and save it. 276 00:27:15,560 --> 00:27:22,200 After doing that, leave it open, load Thunderbird, open up Thunderbird, and check your filter. 277 00:27:22,200 --> 00:27:27,480 And you do this before you edit every single condition, because what will happen is if, 278 00:27:27,480 --> 00:27:31,960 for instance, you skip the step and there was a space missing in between those oars, 279 00:27:32,600 --> 00:27:36,520 you'll get an error when you load the filter. So when you try to run the filter, 280 00:27:36,520 --> 00:27:41,480 Thunderbird or say something like does not recognize filter, some simple like that, 281 00:27:41,480 --> 00:27:46,040 and you'll know, oh, I must have a space missing. I was thinking about creating a second 282 00:27:46,040 --> 00:27:51,640 red jacks just to filter in between those oars and making sure that there was a space in between there. 283 00:27:51,640 --> 00:27:56,680 But I mean, right now, it works flawless. I have no problems. But if it does come up in the future, 284 00:27:56,680 --> 00:28:02,440 I'll probably end up doing that. And I'll probably just include it anyway, which is a safety feature. 285 00:28:02,440 --> 00:28:07,560 Something that runs once I've reconstructed the filter completely and done the second leader, 286 00:28:08,200 --> 00:28:15,080 or a leader too. So in quick recap, open up your file, your filter file, go to see your 287 00:28:15,080 --> 00:28:21,320 blank file, which in my case is CV, grab the condition that you want, which is your actual 288 00:28:21,320 --> 00:28:27,640 filter and properties, paste it over into your blank file, run leader 1 to break it down, run 289 00:28:27,640 --> 00:28:36,680 leader S1 to perform the sorting and capitalization corrections or a capitalization first then sort. 290 00:28:36,680 --> 00:28:43,960 Then run leader in one to make sure that everything has a space after it, perform the capital J. 291 00:28:44,680 --> 00:28:52,440 So if you have 50 different elements, then you'll do 51 capital J to reconstruct it all back 292 00:28:52,440 --> 00:28:59,800 onto one line and complete the process using leader 2, which will add the condition equal, 293 00:28:59,800 --> 00:29:05,880 etc. Then you can just copy that back over to your filter, the actual filter file, 294 00:29:06,440 --> 00:29:13,480 from Thunderbird, delete the old line that you yanked from, replacing it with the new one that you 295 00:29:13,960 --> 00:29:18,600 alphabetized and everything else, and you good to go. Now what you'll also notice is the line 296 00:29:18,600 --> 00:29:25,880 may be shorter, that's because if you had duplicate thing there, the leader S1 with that sort function, 297 00:29:25,880 --> 00:29:33,560 the U attached to search, sort, was going to remove duplicates. So that's why I have the line in 298 00:29:33,560 --> 00:29:37,720 of being like one or two short, yeah, that's why I took out the duplicates. Which is good, 299 00:29:37,720 --> 00:29:43,160 your filter has to become more complex over years and you end up with those duplicates, it'll 300 00:29:43,240 --> 00:29:49,960 slow things down, especially if you have a Yahoo email address, the Yahoo servers are terrible, 301 00:29:49,960 --> 00:29:55,400 and you might think it's Thunderbird being slow, but it's not, it's actually Yahoo, or you know, 302 00:29:55,400 --> 00:30:00,600 whoever you're pulling your mail from, that's where it's bogging down. And this is just how I 303 00:30:01,480 --> 00:30:09,560 manage my filters. Now there is not currently a filter for archiving mail, otherwise I'd be using it. 304 00:30:09,640 --> 00:30:16,360 Instead, what I'm working on doing now, because I've managed, you know, multiple different email 305 00:30:16,360 --> 00:30:21,880 accounts from different places. After I clean things up and got rid of all the promotional 306 00:30:21,880 --> 00:30:29,720 garbage, I do a control A inside of Thunderbird, inside of the directory, with the important emails 307 00:30:29,720 --> 00:30:36,680 I want to keep, control A, selects everything. Then I just tap the A key, and the A key is a shortcut 308 00:30:36,760 --> 00:30:42,760 for archive and Thunderbird. In the show no time, I have some Thunderbird keyboard shortcuts, 309 00:30:42,760 --> 00:30:47,880 I have a link to it anyways, and that way you can familiarize yourself with the shortcuts. 310 00:30:47,880 --> 00:30:54,040 I hope this episode has been informational. I apologize if I stumbled through for myself a little bit, 311 00:30:54,040 --> 00:30:58,200 it's because I've been trying to work around the air conditioning, and I did not want you to be 312 00:30:58,200 --> 00:31:03,240 bothered by the loud hum from the air conditioning. Let me know what you think if you want more on 313 00:31:03,240 --> 00:31:09,160 Thunderbird, especially the email filters. Let me know. I'll try to put some time in on that. 314 00:31:09,160 --> 00:31:14,440 Thank you guys for listening to Hacker Public Radio. Please do a show in response if you can, 315 00:31:14,440 --> 00:31:18,600 or I sure own anything else. Maybe you've got some cool tips about Thunderbird that 316 00:31:18,600 --> 00:31:23,160 we haven't heard about yet, and you feel like we need to know about it. Go ahead and do a show. 317 00:31:23,160 --> 00:31:25,480 I'll see you guys in the next episode. Take care. 318 00:31:33,240 --> 00:31:39,240 Today's show was contributed by a HBR this night like yourself. If you ever thought of recording 319 00:31:39,240 --> 00:31:47,080 podcast, click on our contributally to find out how easy it means. Posting for HBR has been kindly 320 00:31:47,080 --> 00:31:54,920 provided by an onstow.com, the internet archive, and our synced.net. On the satellite stages, 321 00:31:54,920 --> 00:32:02,040 today's show is released on our creative comments, attribution, 4.0 international license.